import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class TabBars extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 10,
      child:Scaffold(
        appBar: AppBar(
           title: Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
             Expanded(
               child: TabBar(
                  isScrollable: true, //如果有多个按钮的话可以滑动
                  tabs: <Widget>[
                      Tab(text: '热门'),
                      Tab(text: '推荐1'),
                      Tab(text: '推荐2'),
                      Tab(text: '推荐3'),
                      Tab(text: '推荐4'),
                      Tab(text: '推荐5'),
                      Tab(text: '推荐6'),
                      Tab(text: '推荐7'),
                      Tab(text: '推荐8'),
                      Tab(text: '推荐9'),
                    ],
                  ),
             )
          ]),
        ),
        body:
         TabBarView(
          children: <Widget>[
            ListView(
              children: <Widget>[
                ListTile(
                  title: Text("tab1"),
                )
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(
                  title: Text("tab1"),
                )
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(
                  title: Text("tab1"),
                )
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(
                  title: Text("tab1"),
                )
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(
                  title: Text("tab1"),
                )
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(
                  title: Text("tab1"),
                )
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(
                  title: Text("tab1"),
                )
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(
                  title: Text("tab1"),
                )
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(
                  title: Text("tab1"),
                )
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(
                  title: Text("tab1"),
                )
              ],
            )
          ],
        ),
      ),
    );
  }
}
